package com.situ.lession1226.config;

import com.situ.lession1226.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                //对哪些请求地址模式进行拦截
                .addPathPatterns("/**")
                //对哪些请求地址模式进行忽略、放行
                .excludePathPatterns("/admin/login/**","/admin/register/**",
                        "/admin/logout/**", "/admin/captcha/**",
                        "/**/*.js", "/**/*.css", "/**/*.jpg", "/**/*.png,/employ/**,/admin/welcome/**,/");

    }
}